<?php

/**
 * This is the model class for table "luaslahankritis".
 *
 * The followings are the available columns in table 'luaslahankritis':
 * @property integer $llk_id
 * @property integer $llk_kec
 * @property double $llk_kering
 * @property double $llk_kritis
 * @property integer $llk_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $llkKec
 */
class Luaslahankritis extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Luaslahankritis the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'luaslahankritis';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('llk_kec, llk_tahun', 'numerical', 'integerOnly'=>true),
			array('llk_kering, llk_kritis', 'numerical'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('llk_id, llk_kec, llk_kering, llk_kritis, llk_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'llkKec' => array(self::BELONGS_TO, 'Kecamatan', 'llk_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'llk_id' => 'Llk',
			'llk_kec' => 'Llk Kec',
			'llk_kering' => 'Llk Kering',
			'llk_kritis' => 'Llk Kritis',
			'llk_tahun' => 'Llk Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('llk_id',$this->llk_id);
		$criteria->compare('llk_kec',$this->llk_kec);
		$criteria->compare('llk_kering',$this->llk_kering);
		$criteria->compare('llk_kritis',$this->llk_kritis);
		$criteria->compare('llk_tahun',$this->llk_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}